package com.kehutong.payfees.dto;

import com.kehutong.payfees.enums.Gender;
import org.coraframework.json.annotation.JSONField;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;
import org.coraframework.util.Objects;

import java.time.LocalDate;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * 客户
 *
 * @Author: liuzhen (liuxing521a@163.com)
 * @Date: 20/4/13 上午9:08
 */
public class Contact extends Entity {

	private static final long serialVersionUID = 296129229105462474L;

	protected Contact(String id) {
        super(id);
    }

	@Column(comment = "省编号")
	private String provinceNo;

	@Column(comment = "省编名称")
	private String provinceName;

	@Column(comment = "市编号")
	private String cityNo;

	@Column(comment = "市名称")
	private String cityName;

	@Column(comment = "区编号")
	private String regionNo;

	@Column(comment = "区名称")
	private String regionName;

    @Column(length = 127, comment = "微信用户id")
    private String userId;
    
    @Column(length = 127, comment = "第三方userId")
    private String thirdUid;

    @Column(length = 64, comment = "昵称")
    private String nickName;

    @Column(comment = "客户手机号")
    private String mobile;
    
    @Column(comment = "性别")
    private Gender gender;

    @Column(length = 255, comment = "头像")
    private String avatar;

    @Column(comment = "生日")
    private LocalDate birthday;

    @Column(length = 64, comment = "邮箱")
    private String email;

    @Column(length = 127, comment = "描述")
    private String remark;

    @JSONField(serialize = false)
    @Column(comment = "和公众号关联标识")
    private String unionid;
    
    @Column(comment = "跟踪员工列表")
    private Set<String> flowIds;
    
    @JSONField(serialize = false)
    @Column(comment = "逻辑删除")
    private boolean deleted;

	public String getProvinceNo() {
		return provinceNo;
	}

	public void setProvinceNo(String provinceNo) {
		this.provinceNo = provinceNo;
	}

	public String getProvinceName() {
		return provinceName;
	}

	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}

	public String getCityNo() {
		return cityNo;
	}

	public void setCityNo(String cityNo) {
		this.cityNo = cityNo;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getRegionNo() {
		return regionNo;
	}

	public void setRegionNo(String regionNo) {
		this.regionNo = regionNo;
	}

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public LocalDate getBirthday() {
		return birthday;
	}

	public void setBirthday(LocalDate birthday) {
		this.birthday = birthday;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getUnionid() {
		return unionid;
	}

	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
	public String getThirdUid() {
		return thirdUid;
	}

	public void setThirdUid(String thirdUid) {
		this.thirdUid = thirdUid;
	}

	public Set<String> getFlowIds() {
		if (Objects.isNull(flowIds)) {
			return Collections.emptySet();
		}
		return flowIds;
	}

	public void setFlowIds(Set<String> flowIds) {
		this.flowIds = flowIds;
	}
	
	public void addFlow(String employeeId) {
		if (Objects.isNull(flowIds)) {
			flowIds = new HashSet<>();
		}
		flowIds.add(employeeId);
	}
}
